/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author edgar
 */
@Entity
@Table(name = "pagos_detalle")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PagosDetalle.findAll", query = "SELECT p FROM PagosDetalle p"),
    @NamedQuery(name = "PagosDetalle.findByNroRecibo", query = "SELECT p FROM PagosDetalle p WHERE p.pagosDetallePK.nroRecibo = :nroRecibo"),
    @NamedQuery(name = "PagosDetalle.findByCodCliente", query = "SELECT p FROM PagosDetalle p WHERE p.pagosDetallePK.codCliente = :codCliente"),
    @NamedQuery(name = "PagosDetalle.findByNroCuota", query = "SELECT p FROM PagosDetalle p WHERE p.pagosDetallePK.nroCuota = :nroCuota"),
    @NamedQuery(name = "PagosDetalle.findByNroFactura", query = "SELECT p FROM PagosDetalle p WHERE p.pagosDetallePK.nroFactura = :nroFactura"),
    @NamedQuery(name = "PagosDetalle.findByMonto", query = "SELECT p FROM PagosDetalle p WHERE p.monto = :monto")})
public class PagosDetalle implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PagosDetallePK pagosDetallePK;
    @Column(name = "monto")
    private Integer monto;
    @JoinColumn(name = "nro_recibo", referencedColumnName = "nro_recibo", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private PagosCabecera pagosCabecera;
    @JoinColumns({
        @JoinColumn(name = "nro_factura", referencedColumnName = "nro_factura", insertable = false, updatable = false),
        @JoinColumn(name = "nro_cuota", referencedColumnName = "nro_cuota", insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private CuotasACobrar cuotasACobrar;
    @JoinColumn(name = "cod_cliente", referencedColumnName = "cod_cliente", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Clientes clientes;

    public PagosDetalle() {
    }

    public PagosDetalle(PagosDetallePK pagosDetallePK) {
        this.pagosDetallePK = pagosDetallePK;
    }

    public PagosDetalle(int nroRecibo, int codCliente, int nroCuota, int nroFactura) {
        this.pagosDetallePK = new PagosDetallePK(nroRecibo, codCliente, nroCuota, nroFactura);
    }

    public PagosDetallePK getPagosDetallePK() {
        return pagosDetallePK;
    }

    public void setPagosDetallePK(PagosDetallePK pagosDetallePK) {
        this.pagosDetallePK = pagosDetallePK;
    }

    public Integer getMonto() {
        return monto;
    }

    public void setMonto(Integer monto) {
        this.monto = monto;
    }

    public PagosCabecera getPagosCabecera() {
        return pagosCabecera;
    }

    public void setPagosCabecera(PagosCabecera pagosCabecera) {
        this.pagosCabecera = pagosCabecera;
    }

    public CuotasACobrar getCuotasACobrar() {
        return cuotasACobrar;
    }

    public void setCuotasACobrar(CuotasACobrar cuotasACobrar) {
        this.cuotasACobrar = cuotasACobrar;
    }

    public Clientes getClientes() {
        return clientes;
    }

    public void setClientes(Clientes clientes) {
        this.clientes = clientes;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pagosDetallePK != null ? pagosDetallePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PagosDetalle)) {
            return false;
        }
        PagosDetalle other = (PagosDetalle) object;
        if ((this.pagosDetallePK == null && other.pagosDetallePK != null) || (this.pagosDetallePK != null && !this.pagosDetallePK.equals(other.pagosDetallePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.PagosDetalle[ pagosDetallePK=" + pagosDetallePK + " ]";
    }
    
}
